package cn.kgc.entity;

import cn.kgc.util.Desensitization;
import cn.kgc.util.DesensitizationType;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author example
 * @version 1.0
 */
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "smbms_role")
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@SuppressWarnings("all")
public class SmbmsRole extends Model<SmbmsRole> implements Serializable {

    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 角色编码
     */
    @TableField(value = "roleCode")
    @Desensitization(desensitizationType = DesensitizationType.CUSTOMER,prefixLen = 1,suffixLen = 1)
    private String rolecode;

    /**
     * 角色名称
     */
    @TableField(value = "roleName")
    private String rolename;

    /**
     * 创建者
     */
    @TableField(value = "createdBy")
    private Long createdby;

    /**
     * 创建时间
     */
    @TableField(value = "creationDate", fill = FieldFill.INSERT)
    @JsonIgnore
    private Date creationDate;

    /**
     * 修改者
     */
    @TableField(value = "modifyBy")
    private Long modifyby;

    /**
     * 修改时间
     */
    @TableField(value = "modifyDate", fill = FieldFill.UPDATE)
    @JsonIgnore
    private Date modifyDate;

    /**
     * 乐观锁
     */
    @Version
    @TableField(value = "version", fill = FieldFill.INSERT)
    private int version;

    /**
     * 逻辑删除
     */
    @TableLogic
    @JsonIgnore
    @TableField(fill = FieldFill.INSERT)
    private int deleted;

    @TableField(exist = false)
    private List<SmbmsUser> smbmsUsers;

}
